***DATAVERSE REPLICATION FILE - THE RETURNS TO OFFICE IN A "RUBBER STAMP" PARLIAMENT (Stata Analysis File)***
**Original: Rory Truex, Ph.D. Candidate, Yale University Department of Political Science, rory.truex@yale.edu**
*Replication: Rush Doshi and Aseem Mahajan

clear

ssc install ebalance,all replace

**Load Cross-section Data**

use "C:\Users\mahajan\Dropbox\Classes\Spring 2015\Replication Paper\Distance\Updated Stata Analysis\Stata Analysis\old5",replace

**Run Entropy Balancing Model**

*W1* RORY ORIGINAL
ebalance npc price2007 roa2007 margin2007 rev2007, targets(1) maxiter(1000) gen(weights_w1)

*W2* RORY ORIGINAL
ebalance npc price2007 roa2007 roa2006 roa2005 margin2007 margin2006 margin2005 rev2007 rev2006 rev2005, targets(1) maxiter(1000) gen(weights_w2)

*W3* RORY ORIGINAL
ebalance npc price2007 roa2007 roa2006 roa2005 margin2007 margin2006 margin2005 rev2007 rev2006 rev2005 so_portion gind_ind* debtratio2007, targets(1) maxiter(1000) gen(weights_w3)

*W4* [Reported in Table 3: Results of Entropy Balancing]
ebalance npc price2007 roa2007 roa2006 roa2005 margin2007 margin2006 margin2005 rev2007 rev2006 rev2005 so_portion gind_ind* debtratio2007 shares2007 txpd2007 firmage, targets(1) maxiter(1000) gen(weights_w4)

*W5* [W4 with Coastal]
ebalance npc price2007 roa2007 roa2006 roa2005 margin2007  margin2006 margin2005 rev2007 rev2006 rev2005 so_portion gind_ind* debtratio2007 shares2007 txpd2007 firmage coastal, targets(1) maxiter(1000) gen(weights_w5)

*W6* [W5 with coastal and no II]
ebalance npc price2007 roa2007 roa2006 roa2005 margin2007 coastal margin2006 margin2005 rev2007 rev2006 rev2005 so_portion debtratio2007 shares2007 txpd2007 firmage, targets(1) maxiter(1000) gen(weights_w6)

keep gvkey weights_w1 weights_w2 weights_w3 weights_w4 weights_w5 weights_w6 coastal
saveold "C:\Users\mahajan\Dropbox\Classes\Spring 2015\Replication Paper\Distance\Updated Stata Analysis\Stata Analysis\weights2.dta",replace


**Merge With Panel Data** DONE IN R AND IMPORTED
clear
use "C:\Users\mahajan\Dropbox\Classes\Spring 2015\Replication Paper\Distance\Updated Stata Analysis\Stata Analysis\trim.panel.3.dta"

**Estimate Fixed Effect Models for Table 4** 

xtset gvkey fyear

*2005-2010 Analysis*
xtreg roa npc interact coastal fyear_ind* [aweight=weights_w1], fe vce(robust)
xtreg roa npc fyear_ind* [aweight=weights_w2], fe vce(robust)
xtreg roa npc fyear_ind* [aweight=weights_w3], fe vce(robust)
xtreg roa npc fyear_ind* [aweight=weights_w4], fe vce(robust)
xtreg roa npc fyear_ind* [aweight=weights_w5], fe vce(robust)
xtreg roa npc fyear_ind* [aweight=weights_w6], fe vce(robust)

xtreg margin npc interact coastal fyear_ind* [aweight=weights_w1], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w5], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w6], fe vce(robust)


xtreg roa npc interact coastal fyear_ind* [aweight=weights_w1], fe vce(robust)
xtreg roa npc interact coastal fyear_ind* [aweight=weights_w2], fe vce(robust)
xtreg roa npc interact coastal fyear_ind* [aweight=weights_w3], fe vce(robust)
xtreg roa npc interact coastal fyear_ind* [aweight=weights_w4], fe vce(robust)
xtreg roa npc interact coastal fyear_ind* [aweight=weights_w5], fe vce(robust)
xtreg roa npc interact coastal fyear_ind* [aweight=weights_w6], fe vce(robust)


xtreg roa npc coastal fyear_ind* [aweight=weights_w1], fe vce(robust)
xtreg roa npc coastal fyear_ind* [aweight=weights_w2], fe vce(robust)
xtreg roa npc coastal fyear_ind* [aweight=weights_w3], fe vce(robust)
xtreg roa npc coastal fyear_ind* [aweight=weights_w4], fe vce(robust)
xtreg roa npc coastal fyear_ind* [aweight=weights_w5], fe vce(robust)
xtreg roa npc coastal fyear_ind* [aweight=weights_w6], fe vce(robust)


xtreg roa coastal fyear_ind* [aweight=weights_w1], fe vce(robust)
xtreg roa coastal fyear_ind* [aweight=weights_w2], fe vce(robust)
xtreg roa coastal fyear_ind* [aweight=weights_w3], fe vce(robust)
xtreg roa coastal fyear_ind* [aweight=weights_w4], fe vce(robust)
xtreg roa coastal fyear_ind* [aweight=weights_w5], fe vce(robust)
xtreg roa coastal fyear_ind* [aweight=weights_w6], fe vce(robust)


xtreg margin npc fyear_ind* [aweight=weights_w1], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w2], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w3], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w4], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w5], fe vce(robust)
xtreg margin npc fyear_ind* [aweight=weights_w6], fe vce(robust)


*2007-2009 Analysis*
xtreg roa npc fyear_ind* if include0709==1 [aweight=weights_w1], fe vce(robust)
xtreg roa npc fyear_ind* if include0709==1 [aweight=weights_w2], fe vce(robust)
xtreg roa npc fyear_ind* if include0709==1 [aweight=weights_w3], fe vce(robust)
xtreg roa npc fyear_ind* if include0709==1 [aweight=weights_w4], fe vce(robust)
xtreg roa npc fyear_ind* if include0709==1 [aweight=weights_w5], fe vce(robust)
xtreg roa npc fyear_ind* if include0709==1 [aweight=weights_w6], fe vce(robust)


xtreg margin npc fyear_ind* if include0709==1 [aweight=weights_w1], fe vce(robust)
xtreg margin npc fyear_ind* if include0709==1 [aweight=weights_w2], fe vce(robust)
xtreg margin npc fyear_ind* if include0709==1 [aweight=weights_w3], fe vce(robust)
xtreg margin npc fyear_ind* if include0709==1 [aweight=weights_w4], fe vce(robust)
xtreg margin npc fyear_ind* if include0709==1 [aweight=weights_w5], fe vce(robust)
xtreg margin npc fyear_ind* if include0709==1 [aweight=weights_w6], fe vce(robust)


**Testing for Conditional Hypotheses**
*All calculations for Figure 3 follow formulas in Brambor et al. 2006* [See "RTOFigure3Data.csv"]
** STOPPED HERE






